import http from "@/utils/request";
//wx 获得openid
export function projectListApi(data: any): Promise<Record<any, any>> {
    return http('/wx/acceptance/project/projectList',data, {
        loading: false,
        method: 'POST',
    });
}

export function projectDetailApi(id: string): Promise<Record<any, any>> {
    return http(`/wx/acceptance/project/projectDetail/${id}`);
}

export function myProjectListApi(status: any): Promise<Record<any, any>> {
    return http(`/wx/acceptance/project/myProjectList/${status}`);
}

export function projectIdApi(id: string): Promise<Record<any, any>> {
    return http(`/wx/acceptance/project/myProjectDetail/${id}`);
}

// 获取分类
export function getCategoryListApi(): Promise<Record<any, any>> {
    return http(`/wx/acceptance/category/categoryTree`);
}

export function addSubOrderApi(params: any): Promise<Record<any, any>> {
    return http(`/wx/acceptance/orderSub/addSubOrder`, params, {
        loading: true,
        method: 'POST',
    });
}

export function updateSubOrderApi(params: any): Promise<Record<any, any>> {
    return http(`/wx/acceptance/orderSub/updateSubOrder`, params, {
        loading: true,
        method: 'POST',
    });
}


/**
 * 确认完成
 * @param projectId
 */
export function confirmationCompletedApi(projectId: string): Promise<Record<any, any>> {
    return http(`/wx/acceptance/project/confirmationCompleted?projectId=${projectId}`);
}
/**
 * 取消订单
 * @param projectId
 */
export function cancelProjectApi(projectId: string): Promise<Record<any, any>> {
    return http(`/wx/acceptance/project/cancelProject?projectId=${projectId}`);
}

/**
 * 取消子订单
 * @param orderSubId
 */
export function cancelOrderSubApi(orderSubId: string): Promise<Record<any, any>> {
    return http(`/wx/acceptance/orderSub/cancelOrderSub?orderSubId=${orderSubId}`);
}

/**
 * 获取用户oaOpenid
 */
export function getOaOpenidByOpenidApi(toUserId: string): Promise<Record<any, any>> {
    return http(`/chat/getOaOpenidByOpenid?openId=${toUserId}`);
}
